namespace hjc {
	export class Singleton {
		protected static $instance: Singleton;
		protected constructor(...params: any[]) { }
		public static instance<T extends Singleton>(...params: any[]): T {
			let clazz = this;
			if (!clazz.$instance || !(clazz.$instance instanceof clazz)) this.$instance = new clazz(...params);
			return clazz.$instance as T;
		}
	}
}